module.exports = ({file, options, env}) => {
  if (!file) {
    return {}
  }
  return {
    parser: file.extname === '.sss' ? 'sugarss' : false,
    plugins: {
      'postcss-import': {root: file.dirname},
      'postcss-preset-env': options['postcss-preset-env'] ? options['postcss-preset-env'] : false,
      'cssnano': env === 'production' ? options.cssnano : false,
      // to edit target browsers: use "browserslist" field in package.json
      'postcss-theme-variables': {
        vars: {
          red: '#F60',
          gray: '#CCC',
          blue: '#03A9F4'
        },
        prefix: '$'
      },
      autoprefixer: {
        browsers: ['Android >= 4.0', 'iOS >= 7']
      }
    }
  }
}
